package view;

import java.awt.Color;
import java.awt.Image;

import javax.swing.ImageIcon;

public class Login extends javax.swing.JFrame {

	private static final long serialVersionUID = 1L;
	private final ImagePanel imagePane;
	private final ImagePanel title;

	public Login() {
		initComponents();
		imagePane = new ImagePanel();
		imagePane.setSize(170, 190);
		// imagePane.setOpaque(false);
		getContentPane().add(imagePane);
		imagePane.setBounds(30, 130, 240, 190);
		imagePane.repaint();
		title = new ImagePanel("icon/logo.png");
		panelTitle.add(title);
		title.setBounds(0, 0, panelTitle.getWidth(), panelTitle.getHeight());
		// title.setOpaque(false);
		title.repaint();

		getContentPane().setBackground(Color.white);

	}

	private void initComponents() {

		panelLogin = new javax.swing.JPanel();
		lblPass = new javax.swing.JLabel();
		lblAccount = new javax.swing.JLabel();
		tfAccount = new javax.swing.JTextField();
		btnLogin = new javax.swing.JButton();
		btnCancel = new javax.swing.JButton();
		tfPass = new javax.swing.JPasswordField();
		jSeparator1 = new javax.swing.JSeparator();
		panelTitle = new javax.swing.JPanel();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Login");
		setBackground(new java.awt.Color(255, 255, 255));
		setBounds(new java.awt.Rectangle(0, 0, 0, 0));
		setPreferredSize(new java.awt.Dimension(700, 400));
		setResizable(false);
		getContentPane().setLayout(null);

		panelLogin.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
				"Login", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
				javax.swing.border.TitledBorder.DEFAULT_POSITION,
				new java.awt.Font("Calibri", 1, 24)));
		panelLogin.setOpaque(false);
		panelLogin.setLayout(null);

		lblPass.setFont(new java.awt.Font("Calibri", 0, 20));
		lblPass.setText("Password:");
		panelLogin.add(lblPass);
		lblPass.setBounds(20, 80, 90, 30);

		lblAccount.setFont(new java.awt.Font("Calibri", 0, 20));
		lblAccount.setText("Account:");
		panelLogin.add(lblAccount);
		lblAccount.setBounds(20, 40, 90, 23);

		tfAccount.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jTextField1ActionPerformed(evt);
			}
		});
		panelLogin.add(tfAccount);
		tfAccount.setBounds(130, 40, 200, 30);

		btnLogin.setFont(new java.awt.Font("Calibri", 1, 18));
		btnLogin.setForeground(new java.awt.Color(0, 102, 204));
		btnLogin.setText("Login");
		btnLogin.setIcon(new ImageIcon("icon/login.png"));

		btnLogin.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
		btnLogin.setMargin(new java.awt.Insets(2, 5, 2, 5));
		btnLogin.setOpaque(false);
		btnLogin.setVerifyInputWhenFocusTarget(false);
		panelLogin.add(btnLogin);
		btnLogin.setBounds(130, 120, 90, 30);

		btnCancel.setFont(new java.awt.Font("Calibri", 1, 18));
		btnCancel.setForeground(new java.awt.Color(0, 102, 204));
		btnCancel.setText("Cancel");
		btnCancel.setIcon(new ImageIcon("icon/logout.png"));

		btnCancel.setIconTextGap(2);
		btnCancel.setMargin(new java.awt.Insets(2, 1, 2, 1));
		btnCancel.setOpaque(false);
		panelLogin.add(btnCancel);
		btnCancel.setBounds(220, 120, 90, 30);
		panelLogin.add(tfPass);
		tfPass.setBounds(130, 80, 200, 30);

		getContentPane().add(panelLogin);
		panelLogin.setBounds(310, 150, 360, 170);

		jSeparator1.setBackground(new java.awt.Color(0, 102, 255));
		jSeparator1.setMinimumSize(new java.awt.Dimension(700, 30));
		jSeparator1.setName("");
		getContentPane().add(jSeparator1);
		jSeparator1.setBounds(0, 340, 700, 10);

		panelTitle.setOpaque(false);
		panelTitle.setLayout(null);
		getContentPane().add(panelTitle);
		panelTitle.setBounds(230, 40, 240, 60);

		pack();
	}

	private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	@SuppressWarnings("unused")
	public static void main(String args[]) {
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Windows".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(Login.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(Login.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(Login.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(Login.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new Login().setVisible(true);
			}
		});
		// System.out.println(System.getProperty("user.dir"));
		Image i = new ImageIcon().getImage();
	}

	private javax.swing.JButton btnLogin;
	private javax.swing.JButton btnCancel;
	private javax.swing.JLabel lblPass;
	private javax.swing.JLabel lblAccount;	private javax.swing.JPanel panelLogin;
	private javax.swing.JPasswordField tfPass;
	private javax.swing.JSeparator jSeparator1;
	private javax.swing.JTextField tfAccount;
	private javax.swing.JPanel panelTitle;

}
